<%@page import="ext.tianma.bom.util.IBAUtil"%>
<%@page import="wt.change2.Changeable2"%>
<%@page import="wt.change2.WTChangeActivity2"%>
<%@page import="wt.fc.QueryResult"%>
<%@page import="wt.change2.ChangeHelper2"%>
<%@page import="java.util.ArrayList"%>
<%@page import="wt.part.WTPart"%>
<%@page import="java.util.List"%>
<%@page import="wt.change2.WTChangeOrder2"%>
<%@page import="wt.fc.Persistable"%>
<%@page import="wt.fc.PersistentReference"%>
<%@page import="wt.workflow.work.WorkItem"%>
<%@page import="wt.fc.ReferenceFactory"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>手动填写半成品编号</title>
</head>
<body>
<%
	/* String workitemoid = request.getParameter("oid"); 
	ReferenceFactory REF_FACTORY = new ReferenceFactory();
	WorkItem aWorkItem = (WorkItem)REF_FACTORY.getReference(workitemoid).getObject();
	PersistentReference pref = aWorkItem.getPrimaryBusinessObject();
	
	String PBOoid = "";
	String number = "";
	String url = "";
	String mutiurl = "";
	String status = "";
	Persistable pbo = null; */
	List<WTPart> list = new ArrayList<WTPart>();

	//out.print("pref:"+pref);
	 if(pref!=null && !"null".equals(pref)){
		//out.print("pref != null");
		pbo = pref.getObject();
		//out.print("pbo:"+pbo);
		if(pbo!=null){
			WTChangeOrder2  eco = (WTChangeOrder2)pbo;
			PBOoid = REF_FACTORY.getReferenceString(pbo);
			number = eco.getNumber();
			status = aWorkItem.getStatus().toString();
			 if("COMPLETED".equals(status)){
				 url = "netmarkets/jsp/ext/BOMECO/tianma/pages/reportHistory.html?econumber="+number;
				 mutiurl = "netmarkets/jsp/ext/BOMECO/tianma/pages/reportHistory.html?econumber="+number;
			}else{
				mutiurl = "netmarkets/jsp/ext/BOMECO/tianma/pages/ecotabs.html?oid="+PBOoid;
				url = "netmarkets/jsp/ext/BOMECO/tianma/pages/search.html?oid="+PBOoid;
			}
			 
			 if(eco!=null){
				 QueryResult queryResultECA = ChangeHelper2.service.getChangeActivities(eco);
					if (queryResultECA != null) {
						while (queryResultECA.hasMoreElements()) {
							WTChangeActivity2 eca = (WTChangeActivity2) queryResultECA.nextElement(); // 获取ECA
							if (eca != null) {
								// 受影响对象
								QueryResult queryResultPart = ChangeHelper2.service.getChangeablesBefore(eca);
								if (queryResultPart != null) {
									while (queryResultPart.hasMoreElements()) {
										Changeable2 changeable = (Changeable2) queryResultPart.nextElement();
										if (changeable != null && changeable instanceof WTPart) {
											WTPart part = (WTPart) changeable;
											//put 受影响对象的属性
											list.add(part);
										}
									}
								}
							}
						}
					}
			 }
			 
			 
			 
			 
			 
			 
			 
			
		}
	} 
%>
<input type="hidden" id="editnumber" value="editnumber">
<%
	for(WTPart part : list){
		//分类
		String type = IBAUtil.getIBAValue(part, "");
		
		%>
		<%=type %>正式编码：<input type="text" id="<%=type %>"></input><br/><br/>
		<%
	}
%>
</body>
</html>